<?php

namespace App\Modules\Admin\Http\Controllers;

use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;

use App\Http\Controllers\Controller;

class LoginController extends Controller
{
    use AuthenticatesUsers;
    //
    protected $redirectTo = '/admin';
    protected $username;

    public function showLoginForm()
    {
        return view('admin::login.login');
    }

    /**
     * 自定义认证驱动
     */
    public function guard()
    {
        return auth()->guard('admin');
    }

    public function logout(Request $request)
    {
        $this->guard('admin')->logout();
        $request->session()->invalidate();

        return redirect(route('admin.login'));
    }
}
